//
//  WBComposeTypeButton.swift
//  Weibo
//
//  Created by kobe on 2016/12/29.
//  Copyright © 2016年 kobe. All rights reserved.
//

import UIKit

// UIControl 内置了 touupInside 事件响应
class WBComposeTypeButton: UIControl {

    @IBOutlet weak var imageView: UIImageView!
    
    @IBOutlet weak var titleLabel: UILabel!
    
    /// 使用图像 名称/标题 创建按钮 按钮布局从xib加载
    
    class func composeTypeButton(imageName:String,title:String) -> WBComposeTypeButton {
            let nib = UINib(nibName: "WBComposeTypeButton", bundle: nil)
        
        let btn = nib.instantiate(withOwner: nil, options: nil)[0] as! WBComposeTypeButton
        
        btn.imageView.image = UIImage(named: imageName)
        btn.titleLabel.text = title
        
        return btn
    }

}
